<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // js Array对象用于定义数组

        //声明数组1
        var arr = new Array(1, 2, 3);
        //js中的数组存储比较灵活
        var arr1 = new Array("a", 555555, false);
        console.log(arr1)

        //声明数组2
        var arr2 = [1111, 2, 3];


        //访问数组元素
        // arr[0]
        arr[0] = "hello";
        console.log(arr)

        console.log(arr[100])

        arr[10] = "hello";
        console.log(arr)

        for (let i = 0; i < arr1.length; i++) {
            console.log(arr1[i] + " - ")
        }


        var arr05 = [1, 2, 3];
        arr05.push(999);//添加元素
        console.log(arr05)

        arr05.splice(1, 2);//删除 从哪个位置开始删除 删几个
        console.log(arr05)

    </script>
</head>

<body>

</body>

</html>